var ul_choose = document.getElementsByTagName("ul")[0];
var li1 = ul_choose.getElementsByTagName("ul")[0].getElementsByTagName("li");
var li2 = ul_choose.getElementsByTagName("ul")[1].getElementsByTagName("li");
var li3 = ul_choose.getElementsByTagName("ul")[2].getElementsByTagName("li");
var li4 = ul_choose.getElementsByTagName("ul")[3].getElementsByTagName("li");
var li5 = ul_choose.getElementsByTagName("ul")[4].getElementsByTagName("li");
var li6 = ul_choose.getElementsByTagName("ul")[5].getElementsByTagName("li");

for (var i = 0; i < li1.length; i++) {
	li1[i].onclick = function(){
		//清楚之前选中的选项
		for (var j = 0; j < li1.length; j++) {
			var a = li1[j].getElementsByTagName("a")[0];
			if (a.hasAttribute("class")) {
				a.attributes.removeNamedItem("class");
			}
		}
		var a = this.getElementsByTagName("a")[0];
		if (!a.hasAttribute("class")) {
			a.className += "active";
		}else{
			a.attributes.removeNamedItem("class");
		}
	}
}

for (var i = 0; i < li2.length; i++) {
	li2[i].onclick = function(){
		//清楚之前选中的选项
		for (var j = 0; j < li2.length; j++) {
			var a = li2[j].getElementsByTagName("a")[0];
			if (a.hasAttribute("class")) {
				a.attributes.removeNamedItem("class");
			}
		}
		var a = this.getElementsByTagName("a")[0];
		if (!a.hasAttribute("class")) {
			a.className += "active";
		}else{
			a.attributes.removeNamedItem("class");
		}
	}
}

for (var i = 0; i < li3.length; i++) {
	li3[i].onclick = function(){
		//清楚之前选中的选项
		for (var j = 0; j < li3.length; j++) {
			var a = li3[j].getElementsByTagName("a")[0];
			if (a.hasAttribute("class")) {
				a.attributes.removeNamedItem("class");
			}
		}
		var a = this.getElementsByTagName("a")[0];
		if (!a.hasAttribute("class")) {
			a.className += "active";
		}else{
			a.attributes.removeNamedItem("class");
		}
	}
}

for (var i = 0; i < li4.length; i++) {
	li4[i].onclick = function(){
		//清楚之前选中的选项
		for (var j = 0; j < li4.length; j++) {
			var a = li4[j].getElementsByTagName("a")[0];
			if (a.hasAttribute("class")) {
				a.attributes.removeNamedItem("class");
			}
		}
		var a = this.getElementsByTagName("a")[0];
		if (!a.hasAttribute("class")) {
			a.className += "active";
		}else{
			a.attributes.removeNamedItem("class");
		}
	}
}

for (var i = 0; i < li5.length; i++) {
	li5[i].onclick = function(){
		//清楚之前选中的选项
		for (var j = 0; j < li5.length; j++) {
			var a = li5[j].getElementsByTagName("a")[0];
			if (a.hasAttribute("class")) {
				a.attributes.removeNamedItem("class");
			}
		}
		var a = this.getElementsByTagName("a")[0];
		if (!a.hasAttribute("class")) {
			a.className += "active";
		}else{
			a.attributes.removeNamedItem("class");
		}
	}
}

for (var i = 0; i < li6.length; i++) {
	li6[i].onclick = function(){
		//清楚之前选中的选项
		for (var j = 0; j < li6.length; j++) {
			var a = li6[j].getElementsByTagName("a")[0];
			if (a.hasAttribute("class")) {
				a.attributes.removeNamedItem("class");
			}
		}
		var a = this.getElementsByTagName("a")[0];
		if (!a.hasAttribute("class")) {
			a.className += "active";
		}else{
			a.attributes.removeNamedItem("class");
		}
	}
}
